#!/bin/bash
echo "后台服务开始执行..."
case $1 in 
    start)
        nohup java -Dfile.encoding=UTF-8 -Dspring.profiles.active=idc -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5555 cloudnote-0.0.1-SNAPSHOT.jar --logging.path=/logs/3333 --server.port=3333 > cloudnote_logs.out 2>&1 &
        tail -f cloudnote_logs.out
        ;;
    stop)    
        ps -ef|grep cloudnote-0.0.1-SNAPSHOT* |grep -v grep |awk '{print $2}'  | sed -e "s/^/kill -9 /g" | sh -
        ;;
    restart)
        "$0" stop
        sleep 3
        "$0" start
        ;;
    status)  ps -ef|grep cloudnote-0.0.1-SNAPSHOT*
        ;;
    *)       
        echo "Example: lpservice.sh [start|stop|restart|status]" ;;
esac
